import React, { Fragment } from 'react'
import { Helmet } from 'react-helmet'
import { useNavigate } from 'react-router-dom'

function Home() {
  const navigate = useNavigate()
  const toDemo = () => navigate('/demo')
  const alertAction = () => alert('hello')

  return (
    <Fragment>
      <Helmet>
        <title>HomePage</title>
        <meta name="description" content="Home page" />
      </Helmet>
      <div>
        <h1>HomePage122</h1>
        <div>
          <button onClick={alertAction}>alert</button>
          {/* 重新加载js */}
          <a href="http://127.0.0.1:3000/demo">链接跳转</a>
          {/* 单页面操作 */}
          <button onClick={toDemo}>路由跳转</button>
        </div>
      </div>
    </Fragment>
  )
}

export default Home
